﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace http
{
    class Program
    {
        static void Main(string[] args)
        {
            //Write a program that extracts all substrings from a given text document, that resemble URL addresses (substrings in format www.<host>...<domain> and substrings, starting with "http://").


            Regex regex = new Regex(@"(http://|www\.)[a-zA-Z_-]+\.[a-z]{1,4}");
            String text =
              "dasg www.asffs.bg safasg.adsg@dgg http://sfdsg.com";
            MatchCollection matches = regex.Matches(text);
            foreach (Match match in matches)
            {
                Console.Write("{0}:{1} ", match.Value, match.Index);
            }

        }
    }
}
